<script>
	$(function(){
		Namespace.register("EBCMS.[namespace]type");
		EBCMS.[namespace]type.refresh = function refresh(){
			EBCMS.CORE.datadict({
				queryParams:{
					sort:'sort',
					order:'desc',
					datadict:'tpltype',
				},
				loadAfter:function(data){
					EBCMS.CORE.compile({
						data:data,
						tpl:'[namespace]type-table',
						target:'#[namespace]type_main',
						compileAfter:function(data){
							console.info(data);
						}
					});
				}
			});
		};
		EBCMS.[namespace]type.refresh();
		EBCMS.[namespace]type.changetemplate = function changetemplate(dir,s){
			EBCMS.[namespace]['dir'] = dir;
			EBCMS.[namespace].refresh();
		}
	});
</script>

<div class="header">
	<div class="header-title" onclick="EBCMS.[namespace]type.refresh();">模板分类</div>
</div>
<div class="body" style="bottom:0px;" id="[namespace]type_main">
</div>

<script id="[namespace]type-table" type="text/html">
	<ul class="list-group tree tree_first" style="border-top: 1px solid #ddd;border-right: 1px solid #ddd;border-bottom: 1px solid #ddd;">
		{{include '[namespace]type-table-item'}}
	</ul>
</script>
<script id="[namespace]type-table-item" type="text/html">
	{{each rows as v n}}
		<li class="list-group-item">
			<div class="btn-group btn-group-xs pull-right" role="group" aria-label="...">
				<a class="btn btn-default btn-xs" href="javascript:EBCMS.[namespace]type.changetemplate('{{v.id}}');" role="button">查看</a>
			</div>
			<label>{{v.text}}</label>
		</li>
	{{/each}}
</script>